//InkYi@2015.11.5
/**
 * QQ/微信表情转换
 * @param msgHTML 一条带有表情的消息
 * @param imgPath 表情路径image/face
 * @param imgType 表情格式.gif(一定要加点)
 * @returns <img src='image/face/75.gif'/>
 */
function MsgReplace(msgHTML, imgPath, imgType) {  
 	var em = [  
 			{"id":0,"str":"/::)","phrase":"[微笑]","url":"0"},
 			{"id":1,"str":"/::~","phrase":"[撇嘴]","url":"1"},
 			{"id":2,"str":"/::B","phrase":"[色]","url":"2"},
 			{"id":3,"str":"/::|","phrase":"[发呆]","url":"3"},
 			{"id":4,"str":"/:8-)","phrase":"[得意]","url":"4"},
 			{"id":5,"str":"/::<","phrase":"[流泪]","url":"5"},
 			{"id":6,"str":"/::$","phrase":"[害羞]","url":"6"},
 			{"id":7,"str":"/::X","phrase":"[闭嘴]","url":"7"},
 			{"id":8,"str":"/::Z","phrase":"[睡]","url":"8"},
 			{"id":9,"str":"/::'(","phrase":"[大哭]","url":"9"},
 			{"id":10,"str":"/::-|","phrase":"[尴尬]","url":"10"},
 			{"id":11,"str":"/::@","phrase":"[发怒]","url":"11"},
 			{"id":12,"str":"/::P","phrase":"[调皮]","url":"12"},
 			{"id":13,"str":"/::D","phrase":"[呲牙]","url":"13"},
 			{"id":14,"str":"/::O","phrase":"[惊讶]","url":"14"},
 			{"id":15,"str":"/::(","phrase":"[难过]","url":"15"},
 			{"id":16,"str":"/::+","phrase":"[酷]","url":"16"},
 			{"id":17,"str":"/:--b","phrase":"[冷汗]","url":"17"},
 			{"id":18,"str":"/::Q","phrase":"[抓狂]","url":"18"},
 			{"id":19,"str":"/::T","phrase":"[吐]","url":"19"},
 			{"id":20,"str":"/:,@P","phrase":"[偷笑]","url":"20"},
 			{"id":21,"str":"/:,@-D","phrase":"[愉快]","url":"21"},
 			{"id":22,"str":"/::d","phrase":"[白眼]","url":"22"},
 			{"id":23,"str":"/:,@o","phrase":"[傲慢]","url":"23"},
 			{"id":24,"str":"/::g","phrase":"[饥饿]","url":"24"},
 			{"id":25,"str":"/:|-)","phrase":"[困]","url":"25"},
 			{"id":26,"str":"/::!","phrase":"[惊恐]","url":"26"},
 			{"id":27,"str":"/::L","phrase":"[流汗]","url":"27"},
 			{"id":28,"str":"/::>","phrase":"[憨笑]","url":"28"},
 			{"id":29,"str":"/::@","phrase":"[大兵]","url":"29"},
 			{"id":30,"str":"/:@f","phrase":"[奋斗]","url":"30"},
 			{"id":31,"str":"/::-S","phrase":"[咒骂]","url":"31"},
 			{"id":32,"str":"/:?","phrase":"[疑问]","url":"32"},
 			{"id":33,"str":"/:,@x","phrase":"[嘘]","url":"33"},
 			{"id":34,"str":"/:,@@","phrase":"[晕]","url":"34"},
 			{"id":35,"str":"/::8","phrase":"[折磨]","url":"35"},
 			{"id":36,"str":"/:,@!","phrase":"[衰]","url":"36"},
 			{"id":37,"str":"/:!!!","phrase":"[骷髅]","url":"7"},
 			{"id":38,"str":"/:xx","phrase":"[敲打]","url":"38"},
 			{"id":39,"str":"/:bye","phrase":"[再见]","url":"39"},
 			{"id":40,"str":"/:wipe","phrase":"[擦汗]","url":"40"},
 			{"id":41,"str":"/:dig","phrase":"[抠鼻]","url":"41"},
 			{"id":42,"str":"/:handclap","phrase":"[鼓掌]","url":"42"},
 			{"id":43,"str":"/:&-(","phrase":"[糗大了]","url":"43"},
 			{"id":44,"str":"/:B-)","phrase":"[坏笑]","url":"44"},
 			{"id":45,"str":"/:<@","phrase":"[左哼哼]","url":"45"},
 			{"id":46,"str":"/:@>","phrase":"[右哼哼]","url":"46"},
 			{"id":47,"str":"/::-O","phrase":"[哈欠]","url":"47"},
 			{"id":48,"str":"/:>-|","phrase":"[鄙视]","url":"48"},
 			{"id":49,"str":"/:P-(","phrase":"[委屈]","url":"49"},
 			{"id":50,"str":"/::'|","phrase":"[快哭了]","url":"50"},
 			{"id":51,"str":"/:X-)","phrase":"[阴险]","url":"51"},
 			{"id":52,"str":"/::*","phrase":"[亲亲]","url":"52"},
 			{"id":53,"str":"/:@x","phrase":"[吓]","url":"53"},
 			{"id":54,"str":"/:8*","phrase":"[可怜]","url":"54"},
 			{"id":55,"str":"/:pd","phrase":"[菜刀]","url":"55"},
 			{"id":56,"str":"/:<W>","phrase":"[西瓜]","url":"56"},
 			{"id":57,"str":"/:beer","phrase":"[啤酒]","url":"57"},
 			{"id":58,"str":"/:basketb","phrase":"[篮球]","url":"58"},
 			{"id":59,"str":"/:oo","phrase":"[乒乓]","url":"59"},
 			{"id":60,"str":"/:coffee","phrase":"[咖啡]","url":"60"},
 			{"id":61,"str":"/:eat","phrase":"[饭]","url":"61"},
 			{"id":62,"str":"/:pig","phrase":"[猪头]","url":"62"},
 			{"id":63,"str":"/:rose","phrase":"[玫瑰]","url":"63"},
 			{"id":64,"str":"/:fade","phrase":"[凋谢]","url":"64"},
 			{"id":65,"str":"/:showlove","phrase":"[示爱]","url":"65"},
 			{"id":66,"str":"/:heart","phrase":"[爱心]","url":"66"},
 			{"id":67,"str":"/:break","phrase":"[心碎]","url":"67"},
 			{"id":68,"str":"/:cake","phrase":"[蛋糕]","url":"68"},
 			{"id":69,"str":"/:li","phrase":"[闪电]","url":"69"},
 			{"id":70,"str":"/:bome","phrase":"[炸弹]","url":"70"},
 			{"id":71,"str":"/:kn","phrase":"[刀]","url":"71"},
 			{"id":72,"str":"/:footb","phrase":"[足球]","url":"72"},
 			{"id":73,"str":"/:ladybug","phrase":"[瓢虫]","url":"73"},
 			{"id":74,"str":"/:shit","phrase":"[便便]","url":"74"},
 			{"id":75,"str":"/:moon","phrase":"[月亮]","url":"75"},
 			{"id":76,"str":"/:sun","phrase":"[太阳]","url":"76"},
 			{"id":77,"str":"/:gift","phrase":"[礼物]","url":"77"},
 			{"id":78,"str":"/:hug","phrase":"[拥抱]","url":"78"},
 			{"id":79,"str":"/:strong","phrase":"[强]","url":"79"},
 			{"id":80,"str":"/:weak","phrase":"[弱]","url":"80"},
 			{"id":81,"str":"/:share","phrase":"[握手]","url":"81"},
 			{"id":82,"str":"/:v","phrase":"[胜利]","url":"82"},
 			{"id":83,"str":"/:@)","phrase":"[抱拳]","url":"83"},
 			{"id":84,"str":"/:jj","phrase":"[勾引]","url":"84"},
 			{"id":85,"str":"/:@@","phrase":"[拳头]","url":"85"},
 			{"id":86,"str":"/:bad","phrase":"[差劲]","url":"86"},
 			{"id":87,"str":"/:lvu","phrase":"[爱你]","url":"87"},
 			{"id":88,"str":"/:no","phrase":"[NO]","url":"88"},
 			{"id":89,"str":"/:ok","phrase":"[OK]","url":"89"},
 			{"id":90,"str":"/:love","phrase":"[爱情]","url":"90"},
 			{"id":91,"str":"/:<L>","phrase":"[飞吻]","url":"91"},
 			{"id":92,"str":"/:jump","phrase":"[跳跳]","url":"92"},
 			{"id":93,"str":"/:shake","phrase":"[发抖]","url":"93"},
 			{"id":94,"str":"/:<O>","phrase":"[怄火]","url":"94"},
 			{"id":95,"str":"/:circle","phrase":"[转圈]","url":"95"},
 			{"id":96,"str":"/:kotow","phrase":"[磕头]","url":"96"},
 			{"id":97,"str":"/:turn","phrase":"[回头]","url":"97"},
 			{"id":98,"str":"/:skip","phrase":"[跳绳]","url":"98"},
 			{"id":99,"str":"/:oY","phrase":"[挥手]","url":"99"},
 			{"id":100,"str":"/:#-0","phrase":"[激动]","url":"100"},
 			{"id":101,"str":"/:hiphot","phrase":"[街舞]","url":"101"},
 			{"id":102,"str":"/:kiss","phrase":"[献吻]","url":"102"},
 			{"id":103,"str":"/:<&","phrase":"[左太极]","url":"103"}
 			];  
    var reg = "/::\\)|/::~|/::B|/::\\||/:8-\\)|/::<|/::$|/::X|/::Z|/::'\\(|/::-\\||/::@|/::P|/::D|/::O|/::\\(|/::\\+|/:--b|/::Q|/::T|/:,@P|/:,@-D|/::d|/:,@o|/::g|/:\\|-\\)|/::!|/::L|/::>|/::,@|/:,@f|/::-S|/:\\?|/:,@x|/:,@@|/::8|/:,@!|/:!!!|/:xx|/:bye|/:wipe|/:dig|/:handclap|/:&-\\(|/:B-\\)|/:<@|/:@>|/::-O|/:>-\\||/:P-\\(|/::'\\||/:X-\\)|/::\\*|/:@x|/:8\\*|/:pd|/:<W>|/:beer|/:basketb|/:oo|/:coffee|/:eat|/:pig|/:rose|/:fade|/:showlove|/:heart|/:break|/:cake|/:li|/:bome|/:kn|/:footb|/:ladybug|/:shit|/:moon|/:sun|/:gift|/:hug|/:strong|/:weak|/:share|/:v|/:@\\)|/:jj|/:@@|/:bad|/:lvu|/:no|/:ok|/:love|/:<L>|/:jump|/:shake|/:<O>|/:circle|/:kotow|/:turn|/:skip|/:oY|/:#-0|/:hiphot|/:kiss|/:<&|/:&>|(\\[[\u4e00-\u9fa5]*\\w*\\]){1}";
 	var regx = new RegExp(reg,'g');
    // 正则查找
    var rs = msgHTML.match(regx);
    if (rs) {  
        for (m = 0; m < rs.length; m++) {  
            for (n = 0; n < em.length; n++) {  
                if (em[n].str == rs[m] || em[n].phrase == rs[m]) {  
                    var t = "<img src='"+ imgPath + em[n].url + imgType + "' />"; 
                    msgHTML = msgHTML.replace(rs[m], t);  
                    break;  
                }  
            }  
        }  
    }
    return msgHTML; 
 }